

export function dateFormat(timestamp: number) {
    let date = new Date(timestamp * 1000);
    return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
}

export function sizeFormat(size: number) {
    if (size < 1024) {
        return `${size}Byte`
    } else if (size < 1024 * 1024) {
        const s = (size / 1024).toFixed(2);
        return `${s}KB`
    } else if (size < 1024 * 1024 * 1024) {
        const s = (size / 1024 / 1024).toFixed(2);
        return `${s}MB`
    }
    return `${size}Byte`
}

export function priceFormat(value: number) {
    return `${value / 100}`
}


